package com.zkj.transaction.services;

import java.util.Date;
import java.util.UUID;

import com.zkj.transaction.dao.ZhuanZhangDAO;

public class ZhuanZhangBOImp implements ZhuanZhangBO {
	private ZhuanZhangDAO zhuanZhangDao;

	public void setZhuanZhangDao(ZhuanZhangDAO zhuanZhangDao) {
		this.zhuanZhangDao = zhuanZhangDao;
	}

	@Override
	public void zhiChu(String zhiChuName, int money) {
		String pkid = UUID.randomUUID().toString();
		// String sql = "insert into " + " shouzhibean values('" + pkid + "' "
		// + ",'zkj','smn','1000','2017-01-01') ";
		String sql = "  UPDATE shouzhibean t     set t.money=t.money-'" + money + "'    " + " where t.zhiChuName='"
				+ zhiChuName + "'                         ";
		zhuanZhangDao.saveOrUpdateRec(sql);

	}

	@Override
	public void shouRu(String shouRuNmae, int money) {
		String sql = "  UPDATE shouzhibean t set    " + "t.money=t.money+'" + money + "'       "
				+ " where t.shouRuName='" + shouRuNmae + "'                         ";
		zhuanZhangDao.saveOrUpdateRec(sql);
	}

	@Override
	public void transfer(String zhiChuName, String shouRuName, int money) {
		zhiChu(zhiChuName, money);
		// int i=1/0;
		shouRu(shouRuName, money);

	}

}
